﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Nature.Toolkit
{
	public partial struct TPVector : Nature.Numerics.IVector
	{
		/// <summary>
        /// Temperature Item
        /// </summary>
		public double T { get; set; }

		/// <summary>
        /// Pressure Item
        /// </summary>
        public double P { get; set; }

		#region IVector Members

        public double this[int i]
        {
            get { return i == 0 ? T : P; }
            set 
			{ 
				if(i==0){ T = value; }
				else { P = value; }
			}
        }

        public int Length { get { return 2; } }

        #endregion

        #region IEnumerable<double> Members

        public IEnumerator<double> GetEnumerator()
        {
            yield return T;
			yield return P;
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            yield return T;
			yield return P;
        }

        #endregion
	
	}


 

	/// <summary>
    /// 
    /// </summary>
	public partial struct TPXVector : Nature.Numerics.IVector
	{
		#region Private Fields
        double[] m_vector;
        #endregion

		public TPXVector(int nsp) : this() { m_vector = new double[nsp + 2]; }

        public TPXVector(double[] vector) : this() { m_vector = vector; }

		public static implicit operator double[](TPXVector v) { return v.m_vector; }

		public static implicit operator TPVector(TPXVector v) { return new TPVector(){ T = v.T, P = v.P }; }

        public static implicit operator TPXVector(double[] array) { return new TPXVector(array); }

		/// <summary>
        /// Number of chemical species
        /// </summary>
		public int Nsp { get { return m_vector.Length - 2; } }

		/// <summary>
        /// 
        /// </summary>
		public double[] X { get { return m_vector; } }

		/// <summary>
        /// Temperature Item
        /// </summary>
		public double T
        {
            get { return m_vector[m_vector.Length - 2]; }
            set { m_vector[m_vector.Length - 2] = value; }
        }

		/// <summary>
        /// Pressure Item
        /// </summary>
        public double P
        {
            get { return m_vector[m_vector.Length - 1]; }
            set { m_vector[m_vector.Length - 1] = value; }
        }

		#region IVector Members

        public double this[int i]
        {
            get { return m_vector[i]; }
            set { m_vector[i] = value; }
        }

        public int Length
        {
            get { return m_vector.Length; }
        }

        #endregion

        #region IEnumerable<double> Members

        public IEnumerator<double> GetEnumerator()
        {
            foreach (double v in m_vector) { yield return v; }
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return m_vector.GetEnumerator();
        }

        #endregion

	}  

	/// <summary>
    /// 
    /// </summary>
	public partial struct TPYVector : Nature.Numerics.IVector
	{
		#region Private Fields
        double[] m_vector;
        #endregion

		public TPYVector(int nsp) : this() { m_vector = new double[nsp + 2]; }

        public TPYVector(double[] vector) : this() { m_vector = vector; }

		public static implicit operator double[](TPYVector v) { return v.m_vector; }

		public static implicit operator TPVector(TPYVector v) { return new TPVector(){ T = v.T, P = v.P }; }

        public static implicit operator TPYVector(double[] array) { return new TPYVector(array); }

		/// <summary>
        /// Number of chemical species
        /// </summary>
		public int Nsp { get { return m_vector.Length - 2; } }

		/// <summary>
        /// 
        /// </summary>
		public double[] Y { get { return m_vector; } }

		/// <summary>
        /// Temperature Item
        /// </summary>
		public double T
        {
            get { return m_vector[m_vector.Length - 2]; }
            set { m_vector[m_vector.Length - 2] = value; }
        }

		/// <summary>
        /// Pressure Item
        /// </summary>
        public double P
        {
            get { return m_vector[m_vector.Length - 1]; }
            set { m_vector[m_vector.Length - 1] = value; }
        }

		#region IVector Members

        public double this[int i]
        {
            get { return m_vector[i]; }
            set { m_vector[i] = value; }
        }

        public int Length
        {
            get { return m_vector.Length; }
        }

        #endregion

        #region IEnumerable<double> Members

        public IEnumerator<double> GetEnumerator()
        {
            foreach (double v in m_vector) { yield return v; }
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return m_vector.GetEnumerator();
        }

        #endregion

	}  

	/// <summary>
    /// 
    /// </summary>
	public partial struct TPDXVector : Nature.Numerics.IVector
	{
		#region Private Fields
        double[] m_vector;
        #endregion

		public TPDXVector(int nsp) : this() { m_vector = new double[nsp + 2]; }

        public TPDXVector(double[] vector) : this() { m_vector = vector; }

		public static implicit operator double[](TPDXVector v) { return v.m_vector; }

		public static implicit operator TPVector(TPDXVector v) { return new TPVector(){ T = v.T, P = v.P }; }

        public static implicit operator TPDXVector(double[] array) { return new TPDXVector(array); }

		/// <summary>
        /// Number of chemical species
        /// </summary>
		public int Nsp { get { return m_vector.Length - 2; } }

		/// <summary>
        /// 
        /// </summary>
		public double[] DX { get { return m_vector; } }

		/// <summary>
        /// Temperature Item
        /// </summary>
		public double T
        {
            get { return m_vector[m_vector.Length - 2]; }
            set { m_vector[m_vector.Length - 2] = value; }
        }

		/// <summary>
        /// Pressure Item
        /// </summary>
        public double P
        {
            get { return m_vector[m_vector.Length - 1]; }
            set { m_vector[m_vector.Length - 1] = value; }
        }

		#region IVector Members

        public double this[int i]
        {
            get { return m_vector[i]; }
            set { m_vector[i] = value; }
        }

        public int Length
        {
            get { return m_vector.Length; }
        }

        #endregion

        #region IEnumerable<double> Members

        public IEnumerator<double> GetEnumerator()
        {
            foreach (double v in m_vector) { yield return v; }
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return m_vector.GetEnumerator();
        }

        #endregion

	}  

	/// <summary>
    /// 
    /// </summary>
	public partial struct TPDYVector : Nature.Numerics.IVector
	{
		#region Private Fields
        double[] m_vector;
        #endregion

		public TPDYVector(int nsp) : this() { m_vector = new double[nsp + 2]; }

        public TPDYVector(double[] vector) : this() { m_vector = vector; }

		public static implicit operator double[](TPDYVector v) { return v.m_vector; }

		public static implicit operator TPVector(TPDYVector v) { return new TPVector(){ T = v.T, P = v.P }; }

        public static implicit operator TPDYVector(double[] array) { return new TPDYVector(array); }

		/// <summary>
        /// Number of chemical species
        /// </summary>
		public int Nsp { get { return m_vector.Length - 2; } }

		/// <summary>
        /// 
        /// </summary>
		public double[] DY { get { return m_vector; } }

		/// <summary>
        /// Temperature Item
        /// </summary>
		public double T
        {
            get { return m_vector[m_vector.Length - 2]; }
            set { m_vector[m_vector.Length - 2] = value; }
        }

		/// <summary>
        /// Pressure Item
        /// </summary>
        public double P
        {
            get { return m_vector[m_vector.Length - 1]; }
            set { m_vector[m_vector.Length - 1] = value; }
        }

		#region IVector Members

        public double this[int i]
        {
            get { return m_vector[i]; }
            set { m_vector[i] = value; }
        }

        public int Length
        {
            get { return m_vector.Length; }
        }

        #endregion

        #region IEnumerable<double> Members

        public IEnumerator<double> GetEnumerator()
        {
            foreach (double v in m_vector) { yield return v; }
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return m_vector.GetEnumerator();
        }

        #endregion

	}  
}